
package com.joysuch.wwyt.datadump.biz.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.zlg.common.datadump.annotation.DataDumpEntity;
import cn.zlg.common.datadump.annotation.DataDumpField;
import com.joysuch.wwyt.bp.entity.dsl.QBpDepart;
import com.joysuch.wwyt.datadump.biz.convertor.*;
import com.joysuch.wwyt.datadump.biz.processor.RiskDistrictImportProcessor;
import com.joysuch.wwyt.datadump.biz.query.RiskDistrictDumpQueryBean;
import com.joysuch.wwyt.risk.entity.dsl.QRiskDistrict;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@DataDumpEntity(name = "risk-district-dump", entity = QRiskDistrict.class, exportQueryConditions = RiskDistrictDumpQueryBean.class,
        importProcessors = RiskDistrictImportProcessor.class, businessName = "风险分区", batchDeleteField = "state", deleteFlagValue = "44")
@Data
public class RiskDistrictDumpBean {

    @NotNull
    @Excel(name = "风险区域编号", width = 20)
    @Length(max = 64)
    @DataDumpField(field = "code", importKey = true)
    private String code;

    @NotNull
    @Excel(name = "风险区域名称", width = 20)
    @DataDumpField(field = "name")
    private String name;

    @NotNull
    @Excel(name = "责任部门名称", width = 20)
    @DataDumpField(field = "responsibleDept", referenceEntity = QBpDepart.class, referenceEntityField = "name")
    private String responsibleDeptName;

    @Excel(name = "上级责任部门名称", width = 20)
    @DataDumpField(field = "responsibleDept", referenceEntity = QBpDepart.class, referenceEntityField = "parentId", exportConvertors = {
            ExportGetDepartNameByIdConvertor.class}, importIgnore = true)
    private String parentResponsibleDeptName;


    @Excel(name = "责任人", width = 128)
    @DataDumpField(field = "responsibleUser", exportConvertors = {ExportRiskDistrictResponsibleUser.class}, importConvertors = ImportRiskDistrictResponsibleUser.class)
    private String responsibleUserNames;

    @NotNull
    @Excel(name = "风险等级", width = 20)
    @Pattern(regexp = "低风险|一般风险|较大风险|重大风险", message = "只能填写以下内容" + "\"低风险|一般风险|较大风险|重大风险\"")
    @DataDumpField(field = "riskLevel", exportConvertors = {ExportRiskLevelNameConvertor.class}, importConvertors = ImportRiskLevelConvertor.class)
    private String riskLevelName;

    @Length(max = 32, message = "字符长度不能超过32")
    @Excel(name = "类型", width = 40)
    @DataDumpField(field = "type", exportConvertors = {ExportRiskDistrictTypeConvertor.class}, importConvertors = ImportRiskDistrictTypeConvertor.class)
    private String typeName;

    @Excel(name = "备注", width = 40)
    @DataDumpField(field = "remark")
    private String remark;

    @DataDumpField(field = "stableRiskLevel", exportConvertors = {ExportRiskLevelNameConvertor.class})
    private String stableRiskLevel;

}
